<div id="flashMessagesContainer" style="clear: both;">
<?php if (!empty($this->messages['success'])) : ?>
    <p style="font-weight: bold !important; color: green !important;">
        <?php foreach ($this->messages['success'] as $message) : ?>
        <?php echo $message . ' '; ?>
        <?php endforeach; ?>
    </p>
<?php endif; ?>

<?php if (!empty($this->messages['warning'])) : ?>
    <p style="font-weight: bold !important; color: yellow !important;">
        <?php foreach ($this->messages['warning'] as $message) : ?>
        <?php echo $message . ' '; ?>
        <?php endforeach; ?>
    </p>
<?php endif; ?>

<?php if (!empty($this->messages['error'])) : ?>
    <p style="font-weight: bold !important; color: red !important;">
        <?php foreach ($this->messages['error'] as $message) : ?>
        <?php echo $message . ' '; ?>
        <?php endforeach; ?>
    </p>
<?php endif; ?>
</div>
<?php $this->inlineScript()->captureStart() ?>
dojo.addOnLoad(
    function()
    {
        var flashMessagesContainer = dojo.byId('flashMessagesContainer')

        if (flashMessagesContainer.innerHTML == '') return;

        dojo.fadeOut({
            node: flashMessagesContainer,
            duration: 5000,
            onEnd: function(){
                //dojo.byId(id).style.display = 'none';
                //if (typeof additionalOnEndCallback == 'function') {
                //    additionalOnEndCallback();
                //}
            }
        }).play();
    }
);
<?php $this->inlineScript()->captureEnd() ?>